"use strict";var TraiwiJS=function(){};TraiwiJS.prototype.pauseEvent=function(t){return t.stopPropagation&&t.stopPropagation(),t.preventDefault&&t.preventDefault(),t.cancelBubble=!0,t.returnValue=!1,!1},TraiwiJS.prototype.getUrl=function(){var t=location.protocol+"//"+location.host+location.pathname,e=t.substring(t.lastIndexOf("/")+1);return".do"==e.substr(-3,3)&&(t=t.substr(0,t.length-e.length)),t};var TraiwiJS=TraiwiJS||{};TraiwiJS.AreaPrinter=function(){var t=this;t.x1=0,t.y1=0,t.x2=0,t.y2=0;var e=document.createElement("div");e.setAttribute("id","traiwijs-areaprinter"),e.style.position="absolute",e.style.display="none",e.style.zIndex=1e5,e.style.border="1px dotted #000",e.style.backgroundColor="rgba(255,255,255,.5)",document.body.appendChild(e),t.div=e,t.areaPrinterButton=document.getElementById("traiwijs-areaprinter-button"),null!=t.areaPrinterButton&&t.areaPrinterButton.addEventListener("click",function(e){t.toggleState(e)},!0)},TraiwiJS.AreaPrinter.prototype.toggleState=function(t){var e=this;TraiwiJS.prototype.pauseEvent(t),e.areaPrinterButton.classList.contains("traiwijs-active")?(e.areaPrinterButton.classList.remove("traiwijs-active"),e.deactivate()):(e.areaPrinterButton.classList.add("traiwijs-active"),e.activate())},TraiwiJS.AreaPrinter.prototype.activate=function(){document.addEventListener("mousedown",this,!1),document.addEventListener("mouseup",this,!1)},TraiwiJS.AreaPrinter.prototype.deactivate=function(){document.removeEventListener("mousedown",this,!1),document.removeEventListener("mouseup",this,!1)},TraiwiJS.AreaPrinter.prototype.handleEvent=function(t){switch(t.type){case"mousedown":this.start(t);break;case"mousemove":this.resize(t);break;case"mouseup":this.finish(t)}},TraiwiJS.AreaPrinter.prototype.redraw=function(){var t=this,e=Math.min(t.x1,t.x2),i=Math.max(t.x1,t.x2),a=Math.min(t.y1,t.y2),r=Math.max(t.y1,t.y2);t.div.style.left=e+"px",t.div.style.top=a+"px",t.div.style.width=i-e+"px",t.div.style.height=r-a+"px"},TraiwiJS.AreaPrinter.prototype.start=function(t){var e=this;return"traiwijs-areaprinter-button"==t.target.getAttribute("id")?!1:(document.addEventListener("mousemove",e,!1),e.x1=t.pageX,e.y1=t.pageY,e.x2=t.pageX,e.y2=t.pageY,e.redraw(),void(e.div.style.display="block"))},TraiwiJS.AreaPrinter.prototype.resize=function(t){var e=this;TraiwiJS.prototype.pauseEvent(t),e.x2=t.pageX,e.y2=t.pageY,e.redraw()},TraiwiJS.AreaPrinter.prototype.finish=function(t){var e=this;return"traiwijs-areaprinter-button"==t.target.getAttribute("id")?!1:(document.removeEventListener("mousemove",e,!1),e.areaPrinterButton.classList.remove("traiwijs-active"),e.deactivate(),e.div.style.display="none",void e.generate())},TraiwiJS.AreaPrinter.prototype.generate=function(){var t=this;html2canvas(document.body).then(function(e){var i=document.createElement("canvas"),a=i.getContext("2d");i.setAttribute("width",t.div.style.width),i.setAttribute("height",t.div.style.height);var r=new Image;r.onload=function(){var e=parseInt(t.div.style.left),i=parseInt(t.div.style.top),n=window.innerWidth,o=window.innerHeight,s=window.innerWidth,d=window.innerHeight,u=0,c=0;a.drawImage(r,e,i,n,o,u,c,s,d)},r.src=e.toDataURL();var n=window.open();n.document.body.appendChild(i),n.focus(),n.print()})};var TraiwiJS=TraiwiJS||{};TraiwiJS.Datepicker=function(t){this.options={prevText:"<",prevStatus:"",prevJumpText:"<<",prevJumpStatus:"",nextText:">",nextStatus:"",nextJumpText:">>",nextJumpStatus:"",currentText:"heute",currentStatus:"",todayText:"heute",todayStatus:"",clearText:"-",clearStatus:"",closeText:"schließen",closeStatus:"",monthNames:["Januar","Februar","März","April","Mai","Juni","Juli","August","September","Oktober","November","Dezember"],monthNamesShort:["Jan","Feb","Mär","Apr","Mai","Jun","Jul","Aug","Sep","Okt","Nov","Dez"],dayNames:["Sonntag","Montag","Dienstag","Mittwoch","Donnerstag","Freitag","Samstag"],dayNamesShort:["So","Mo","Di","Mi","Do","Fr","Sa"],dayNamesMin:["So","Mo","Di","Mi","Do","Fr","Sa"],showMonthAfterYear:!1,showOn:"focus",dateFormat:"dd.mm.yy",firstDay:1},this.datepicker=$("#"+t).datepicker(this.options)},TraiwiJS.Datepicker.prototype.get=function(){return this.datepicker},TraiwiJS.Datepicker.prototype.parseDate=function(t,e){e=e||"yyyy-mm-dd";var i=t.match(/(\d+)/g),a=0,r={};return e.replace(/(yyyy|dd|mm)/g,function(t){r[t]=a++}),new Date(i[r.yyyy],i[r.mm]-1,i[r.dd])};var TraiwiJS=TraiwiJS||{};TraiwiJS.Dialoger=function(t){var e=this;e.buttonClass=t||"btn gray fa fa-times float-left",e.dialogs=[],e.default_buttons={text:" ","class":e.buttonClass,click:function(){$(this).dialog("close")},showText:!0}},TraiwiJS.Dialoger.prototype.add=function(){var t=this,e=Math.floor(Math.random()*(1e6-1))+1,i=document.createElement("div");i.setAttribute("id","dialog-"+e),i.setAttribute("class","dialoger-generated"),document.body.appendChild(i);var a=$("#dialog-"+e).dialog({autoOpen:!1,height:"auto",width:$(window).width()>300?300:$(window).width()-20,modal:!0,show:{effect:"fade",duration:200},hide:{effect:"fade",duration:100},buttons:[t.default_buttons]});return t.dialogs[e]=$(a),$(a)},TraiwiJS.Dialoger.prototype.get=function(t){var e=this;return void 0==e.dialogs[t]?!1:e.dialogs[t]};var TraiwiJS=TraiwiJS||{};TraiwiJS.PdfResponser=function(t,e,i){$("#"+t).click(function(){1==$("#ajax-loading").length&&$("#ajax-loading").dialog("open");var t=i||{};$.post(TraiwiJS.prototype.getUrl()+"/"+e+".do",t,function(t){if(1==$("#ajax-loading").length&&$("#ajax-loading").dialog("close"),"false"==t)alert("Die PDF konnte nicht erstellt werden.");else if(1==$.browser.device)window.open(t,"_self");else{var e=window.open(t,"_blank");e||alert("Pop-Ups werden durch Ihre Browser-Einstellungen blockiert.")}})})};